package com.cw.base.common.dispatch.task.facade.pojo.request;

import java.io.Serializable;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.cw.base.common.dispatch.pojo.BaseReqDto;
import com.cw.base.common.dispatch.pojo.BaseUserReqDto;
import com.cw.base.common.dispatch.task.facade.call.NormalCall;
import com.cw.base.common.dispatch.task.facade.callback.TaskCallBack;
import com.cw.base.common.dispatch.task.facade.condition.LoopCondition;

import lombok.Data;

/**
 * Created on 15/11/9.
 *
 * @author zhangcheng
 */
@Data
public class TaskRequest implements Serializable {

    private static final long serialVersionUID = 7829816539537026199L;

    @Valid
    @NotNull(message = "基本的变量为空！")
    private BaseReqDto request;

    private BaseUserReqDto baseUserReqDto;

    @NotBlank(message = "目标方法变量为空！")
    private String targetMethod;

    @Valid
    @NotNull(message = "目标对象变量为空！")
    private Object targetObject;

    private Object[] parameters;

    /**
     * 执行类
     */
    private String targetClass;

    /**
     * 执行类构造函数入参
     */
    private Object[] constructorParameters;

    private long delayExecTime;

    private long apartExecTime;

    private NormalCall normalTask;

    /** 执行错误回调 */
    private TaskCallBack errorTaskCallBack;

    /** 任务执行完成之后回调 */
    private TaskCallBack taskCallBack;

    private LoopCondition loopCondition;

    /** 最多执行次数 **/
    private int execNum;

    /** 如果为true 则 失败继续往队列里插入，如果为false 则调用 回调接口 */
    private boolean errorLoop;

    /** 执行正常回调类 **/
    private String taskCallBackClass;
    /** 执行正常回调方法 **/
    private String taskCallBackMethod;

    /** 执行错误回调类 **/
    private String errorTaskCallBackClass;
    /** 执行错误回调方法 **/
    private String errorTaskCallBackMethod;

    /**
     * 回调类构造函数入参
     */
    private Object[] callBackConstructorParameters;

    /** 业务变量 */
    private Object[] businessParam;

}
